/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once
#include <deque>

#include "Component.h"
#include "../game/DialogModel.h" // temp

namespace gui
{

class MDialogBox : public gui::Component
{
public:
    MDialogBox(const gui::Component *c);

    /** Load a conversation from a file */
    bool LoadDialog( const std::string &file );
    /** Clear this boxs contents */
    void Clear() { m_model.Clear(); };

    /** Set/Get Title */
    void SetTitle( const std::string &s ) { m_title = s; };
    std::string GetTitle() { return m_title; };


    /** Set/Get Text */
    void SetText( const std::string &s ) { m_text = s; };
    std::string GetText() { return m_text; };

    /** Update this component */
    //void Update( long dt );
    void Render( IRender* r );

    /** Handle the input */
    bool HandleInput();

private:
// TODO convert this to a 'Model'
    typedef MModel DialogModel;
    DialogModel     m_model;

    /** Check the line feed */
    void WrapText(const std::string &text, int width, int height );

    std::string m_title;
    std::string m_text;

    typedef std::deque<std::string> type_Strings;
    type_Strings m_nextLine;
public:
    virtual ~MDialogBox(void);
};




};